using System.ComponentModel.DataAnnotations;

namespace MediPlatform.Read.Api.Models
{
    /// <summary>
    /// 退款申请查询请求模型
    /// </summary>
    public class RefundApplicationQueryRequest
    {
        /// <summary>
        /// 患者姓名或手机号
        /// </summary>
        public string? PatientInfo { get; set; }

        /// <summary>
        /// 申请开始时间
        /// </summary>
        public DateTime? ApplyStartTime { get; set; }

        /// <summary>
        /// 申请结束时间
        /// </summary>
        public DateTime? ApplyEndTime { get; set; }

        /// <summary>
        /// 状态筛选：0-待处理, 1-已处理, 2-已拒绝, null-全部
        /// </summary>
        public int? Status { get; set; }

        /// <summary>
        /// 当前页码
        /// </summary>
        [Range(1, int.MaxValue)]
        public int PageIndex { get; set; } = 1;

        /// <summary>
        /// 每页大小
        /// </summary>
        [Range(1, 100)]
        public int PageSize { get; set; } = 10;
    }

    /// <summary>
    /// 退款申请列表项响应模型
    /// </summary>
    public class RefundApplicationListItem
    {
        /// <summary>
        /// 服务编号（退款申请编号）
        /// </summary>
        public string? ApplicationNo { get; set; }

        /// <summary>
        /// 申请时间
        /// </summary>
        public DateTime? ApplyTime { get; set; }

        /// <summary>
        /// 用户信息（手机号）
        /// </summary>
        public string? UserPhone { get; set; }

        /// <summary>
        /// 退款金额
        /// </summary>
        public decimal? Amount { get; set; }

        /// <summary>
        /// 来源（退款类型）
        /// </summary>
        public string? Source { get; set; }

        /// <summary>
        /// 状态
        /// </summary>
        public int? Status { get; set; }

        /// <summary>
        /// 状态文本
        /// </summary>
        public string? StatusText { get; set; }

        /// <summary>
        /// 处理时间
        /// </summary>
        public DateTime? ProcessTime { get; set; }

        /// <summary>
        /// 申请ID
        /// </summary>
        public long? Id { get; set; }
    }

    /// <summary>
    /// 退款申请分页响应模型
    /// </summary>
    public class RefundApplicationPagedResponse
    {
        /// <summary>
        /// 数据列表
        /// </summary>
        public List<RefundApplicationListItem> Items { get; set; } = new();

        /// <summary>
        /// 总记录数
        /// </summary>
        public int TotalCount { get; set; }

        /// <summary>
        /// 总页数
        /// </summary>
        public int TotalPages { get; set; }

        /// <summary>
        /// 当前页码
        /// </summary>
        public int CurrentPage { get; set; }

        /// <summary>
        /// 每页大小
        /// </summary>
        public int PageSize { get; set; }
    }

    /// <summary>
    /// 退款申请详情响应模型
    /// </summary>
    public class RefundApplicationDetailResponse
    {
        /// <summary>
        /// 申请ID
        /// </summary>
        public long? Id { get; set; }

        /// <summary>
        /// 申请编号
        /// </summary>
        public string? ApplicationNo { get; set; }

        /// <summary>
        /// 订单ID
        /// </summary>
        public long? OrderId { get; set; }

        /// <summary>
        /// 用户ID
        /// </summary>
        public long? UserId { get; set; }

        /// <summary>
        /// 退款金额
        /// </summary>
        public decimal? Amount { get; set; }

        /// <summary>
        /// 状态
        /// </summary>
        public int? Status { get; set; }

        /// <summary>
        /// 状态文本
        /// </summary>
        public string? StatusText { get; set; }

        /// <summary>
        /// 申请时间
        /// </summary>
        public DateTime? ApplyTime { get; set; }

        /// <summary>
        /// 处理时间
        /// </summary>
        public DateTime? ProcessTime { get; set; }

        /// <summary>
        /// 处理人员ID
        /// </summary>
        public long? ProcessorId { get; set; }

        /// <summary>
        /// 处理备注
        /// </summary>
        public string? Remark { get; set; }

        /// <summary>
        /// 退款渠道
        /// </summary>
        public string? RefundChannel { get; set; }

        /// <summary>
        /// 退款类型
        /// </summary>
        public string? RefundType { get; set; }

        /// <summary>
        /// 扩展信息
        /// </summary>
        public string? ExtraInfo { get; set; }

        /// <summary>
        /// 退款日志列表
        /// </summary>
        public List<RefundLogItem> RefundLogs { get; set; } = new();
    }

    /// <summary>
    /// 退款日志项
    /// </summary>
    public class RefundLogItem
    {
        /// <summary>
        /// 日志ID
        /// </summary>
        public long? Id { get; set; }

        /// <summary>
        /// 状态
        /// </summary>
        public int? Status { get; set; }

        /// <summary>
        /// 状态文本
        /// </summary>
        public string? StatusText { get; set; }

        /// <summary>
        /// 操作人员ID
        /// </summary>
        public long? OperatorId { get; set; }

        /// <summary>
        /// 操作时间
        /// </summary>
        public DateTime? OperateTime { get; set; }

        /// <summary>
        /// 操作备注
        /// </summary>
        public string? Remark { get; set; }
    }

    /// <summary>
    /// 处理退款申请请求
    /// </summary>
    public class ProcessRefundRequest
    {
        /// <summary>
        /// 退款申请ID
        /// </summary>
        public long Id { get; set; }

        /// <summary>
        /// 处理备注
        /// </summary>
        public string? Remark { get; set; }

        /// <summary>
        /// 操作员ID（当前登录用户）
        /// </summary>
        public long OperatorId { get; set; }
    }

    /// <summary>
    /// 确认退款请求
    /// </summary>
    public class ConfirmRefundRequest : ProcessRefundRequest
    {
        // 继承ProcessRefundRequest的所有属性
    }

    /// <summary>
    /// 拒绝退款请求
    /// </summary>
    public class RejectRefundRequest : ProcessRefundRequest
    {
        // 继承ProcessRefundRequest的所有属性
    }
} 